##########################################################################
#### Replication code for Figure 1                                     ###
#### Andrew B. Hall                                                    ###  
#### Requires Stata code "Hall_PSRM_Replication.do" to be run first!   ###
##########################################################################
rm(list=ls())
if (!require(foreign)) install.packages("foreign")
library(foreign)


data <- read.dta("diff_graph_for_r.dta")

pdf(file="did.pdf", height=6, width=7)
plot(x=data$t, y=data$control_mean, col="white", xlab="Years Until Ban", ylab="Mean Dem Share of Legislature", xaxt="n", yaxt="n", ylim=c(0.4, 0.7), cex.lab=1.2)
abline(v=0, lty=1, col="gray70")
lines(x=data$t, y=data$control_mean, col="gray30", lwd=4, lty=2)
lines(x=data$t, y=data$dem_frac_treat, col="black", lwd=4)
axis(side=1)
axis(side=2, las=1, at=seq(.4,.7,.1), labels=seq(.4,.7,.1))
legend("topright", c("Treated States", "Control States"), col=c("black", "gray30"), lty=c(1,2), cex=1.2, bty="n")
dev.off()